<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="utf-8">
		<title>待审核博客列表</title>
		<script src="/js/axios.js"></script>
		<script src="/js/vue.js"></script>
		<script src="/js/element-ui/index.js"></script>
		<link rel="stylesheet" type="text/css" href="/js/element-ui/index.css" />
	</head>
	<body>
		<div id="box">
			<el-container>
				<el-header>
					<div th:include="~{common/nav-manager::manager}"></div>
				</el-header>
				<el-container>
					<el-main>
						<el-table :data="awatingBlogs">
							<el-table-column label="标题" prop="title"></el-table-column>
							<el-table-column label="用户名" prop="nickname"></el-table-column>
							<el-table-column label="帐号状态">
								<template slot-scope="scope">
									<span v-if="scope.row.audit==1" style="color: orange;">待审核</span>
									<span v-else style="color: red;">未通过</span>
								</template>
							</el-table-column>
							<el-table-column label="发表时间" prop="createTime"></el-table-column>
							<el-table-column label="操作" min-width="100px">
								<template slot-scope="scope">
									<el-button style="background-color: green;color: white;" @click="pass(scope.row.id)">通过</el-button>
									<el-button style="background-color: red;color: white;" @click="noPass(scope.row.id)">不通过</el-button>
								</template>
							</el-table-column>
						</el-table>
					</el-main>
				</el-container>
			</el-container>
		</div>
	</body>
	<script>
		new Vue({
			el: "#box",
			data: {
				awatingBlogs:[]
			},
			methods: {
				pass(id){
					let _this = this
					axios.get("/api/adm/blog/pass/"+id)
					.then(function(response){
						_this.awatingBlogs = response.data.data
					})
				},
				noPass(id){
					let _this = this
					axios.get("/api/adm/blog/noPass/"+id)
					.then(function(response){
						_this.awatingBlogs = response.data.data
					})
				}
			},
			mounted() {
				let _this = this
				axios.get("/api/adm/blog/findAll")
				.then(function(response){
					_this.awatingBlogs = response.data.data
				})
				
			}
		})
	</script>
	<style>
		.el-main {
			background-color: #E9EEF3;
			color: #333;
			text-align: center;
			line-height: 160px;
		}
	</style>
</html>
